// 封装文章相关接口
import axios from '@/utils/request'
// 1.获取文章列表
export const getArticleList = function (params) {
  return axios({
    url: '/mp/v1_0/articles',
    method: 'GET',
    params
  })
}
// 2.获取文章频道
export const getArticleChanns = function (params) {
  return axios({
    url: '/mp/v1_0/channels',
    method: 'GET',
    params
  })
}
// 3.删除文章接口
export const delArticle = function (id) {
  return axios({
    url: `/mp/v1_0/articles/${id}`,
    method: 'DELETE'
  })
}
// 4.发布文章接口
export const addArticle = function (params, data) {
  return axios({
    url: '/mp/v1_0/articles',
    method: 'POST',
    params,
    data
  })
}
// 5获取文章详情
export const getArticleDetail = function (id) {
  return axios({
    url: `/mp/v1_0/articles/${id}`,
    method: 'GET'
  })
}

// 6.修改文章详情
export const updateArticle = function (id, params, data) {
  return axios({
    url: `/mp/v1_0/articles/${id}`,
    method: 'PUT',
    params,
    data
  })
}
